Skip to content

Conversation

silvanocerza
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • [x Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

Fixes a panic on compile.

  • What is the current behavior?
$ arduino-cli compile -b aduino:avr:uno ~/Documents/Arduino/Blink/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x10128f424]

goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).String(...)
	/Users/alien/workspace/arduino-cli/arduino/cores/cores.go:262
github.com/arduino/arduino-cli/commands/compile.Compile(0x1016a14a0, 0x1400003c0c8, 0x140001c5c58, 0x10168e3a8, 0x14000010018, 0x10168e3a8, 0x14000010020, 0x14000412d00, 0x0, 0x0, ...)
	/Users/alien/workspace/arduino-cli/commands/compile/compile.go:127 +0xa44
github.com/arduino/arduino-cli/cli/compile.run(0x140003faf00, 0x140004124e0, 0x1, 0x3)
	/Users/alien/workspace/arduino-cli/cli/compile/compile.go:194 +0x41c
github.com/spf13/cobra.(*Command).execute(0x140003faf00, 0x140004124b0, 0x3, 0x3, 0x140003faf00, 0x140004124b0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x1d0
github.com/spf13/cobra.(*Command).ExecuteC(0x14000301680, 0x1, 0x1, 0x0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
	/Users/alien/workspace/arduino-cli/main.go:31 +0xd4
$ arduino-cli compile -b arduino:av:uno ~/Documents/Arduino/Blink/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x1032df424]

goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).String(...)
	/Users/alien/workspace/arduino-cli/arduino/cores/cores.go:262
github.com/arduino/arduino-cli/commands/compile.Compile(0x1036f14a0, 0x140001a4008, 0x1400009bc58, 0x1036de3a8, 0x140001b0008, 0x1036de3a8, 0x140001b0010, 0x1400043cd00, 0x0, 0x0, ...)
	/Users/alien/workspace/arduino-cli/commands/compile/compile.go:127 +0xa44
github.com/arduino/arduino-cli/cli/compile.run(0x14000426f00, 0x1400043c4e0, 0x1, 0x3)
	/Users/alien/workspace/arduino-cli/cli/compile/compile.go:194 +0x41c
github.com/spf13/cobra.(*Command).execute(0x14000426f00, 0x1400043c4b0, 0x3, 0x3, 0x14000426f00, 0x1400043c4b0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x1d0
github.com/spf13/cobra.(*Command).ExecuteC(0x1400032d680, 0x1, 0x1, 0x0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
	/Users/alien/workspace/arduino-cli/main.go:31 +0xd4
  • What is the new behavior?
$ arduino-cli compile -b aduino:avr:uno ~/Documents/Arduino/Blink/

Error during build: Platform 'arduino:vr' not found: platform not installed                                                                        
$ arduino-cli compile -b arduino:av:uno  ~/Documents/Arduino/Blink/

Error during build: Platform 'arduino:av' not found: platform not installed

Nope.

  • Other information:

Fixes #1531.


See how to contribute

@silvanocerza silvanocerza added type: imperfection Perceived defect in any part of project topic: CLI Related to the command line interface labels Jan 28, 2022
@silvanocerza silvanocerza self-assigned this Jan 28, 2022
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 28, 2022
@silvanocerza silvanocerza merged commit 085a31b into master Jan 28, 2022
@silvanocerza silvanocerza deleted the scerza/fix-compile-panic branch January 28, 2022 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling a command with an FQBN with unexisting package or architecture causes a panic
3 participants